import { addImageService, getImgListService } from '../../../model/service/love/loveImageService';

// 添加图片信息
export async function addLoveImg(ctx: Context, next: Next): Promise<void> {
  const { body } = ctx.request;
  try {
    const result = await addImageService(body);
    ctx.api.success(result, 'sucess');
  } catch (error) {
    ctx.api.fail(-1, error);
  }
  
  return next();
}

// 删除机构信息
export async function deleteLoveImg(ctx: Context, next: Next): Promise<void> {
  try {
    // TODO 删除图片
    ctx.api.success({}, 'sucess');
  } catch (error) {
    ctx.api.fail(-1, error);
  }
  
  return next();
}

// 更新机构信息
export async function updateLoveImg(ctx: Context, next: Next): Promise<void> {
  try {
    ctx.api.success({}, 'sucess');
  } catch (error) {
    ctx.api.fail(-1, error);
  }
  
  return next();
}

// 获取机构信息列表
export async function getLoveImgList(ctx: Context, next: Next): Promise<void> {
  try {
    const result = await getImgListService();
    ctx.api.success(result, 'sucess');
  } catch (error) {
    ctx.api.fail(-1, error);
  }
  
  return next();
}